package com.cloud.shiro.config;

import com.cloud.shiro.entity.User;

import java.util.*;

/**
 * @author zhaoyangfu - 2020/7/23 9:52
 */
public class DBCache {

    public static final Map<String, User> USER_CACHE = new HashMap<>();

    public static final Map<String, Collection<String>> PERMISSION_CACHE = new HashMap<>();

    static {
        // TODO 假设这是数据库记录
        USER_CACHE.put("u1", new User(1L, "u1", "p1", "admin", true));
        USER_CACHE.put("u2", new User(2L, "u2", "p2", "admin", false));
        USER_CACHE.put("u3", new User(3L, "u3", "p3", "test", true));

        PERMISSION_CACHE.put("admin", Arrays.asList("user:list", "user:add", "user:edit"));
        PERMISSION_CACHE.put("test", Collections.singletonList("user:list"));

    }
}
